package com.swizipuremvc.core.utils
{

	public class ScopeUtil
	{
		public static function getName(scopeName:String, baseName:Object):String
		{
			return scopeName ? scopeName + "." + baseName : baseName.toString();
		}

		public static function getScopeName(name:String):String
		{
			var i:int = name.indexOf(".");
			if (i > -1)
			{
				return name.substring(0, i);
			}
			return null;
		}

		public static function getBaseName(scopeName:String, name:String):String
		{
			var prefix:String = scopeName + ".";
			if (name.indexOf(prefix) == 0)
			{
				return name.substring(prefix.length);
			}
			return name;
		}
	}
}
